<?php

// use App\Http\Controllers\CaptchaController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;


/**
 * 
 * ruoyi laravel admin 后台接口, 对接ruoyi-vue3
 * 默认前缀/admin & 默认auth:sanctum
 * 
 */


// 免登录
Route::withoutMiddleware('auth:sanctum')->group(function() {

    Route::get('/phpinfo', fn() => config('app.debug') ? phpinfo() : 'phpinfo()');
    Route::get('/logs', [\Rap2hpoutre\LaravelLogViewer\LogViewerController::class, 'index']);

    // 验证码
    Route::get('/captchaImage', [App\Http\Controllers\System\CaptchaController::class, 'getCode']);
    // 登录方法
    // Route::post('/login', [App\Http\Controllers\System\SysLoginController::class, 'login']);
    Route::any('/login', [App\Http\Controllers\System\SysLoginController::class, 'login']);
    Route::any('/logout', [App\Http\Controllers\System\SysLoginController::class, 'logout']);

    Route::resource('/users', '\App\Http\Controllers\Admin\System\SysUserController');

    // Route::get('/unauth', [App\Http\Controllers\System\SysLoginController::class, 'unauth'])->name('login');
});

// 获取用户信息
Route::get('/getInfo', [App\Http\Controllers\System\SysLoginController::class, 'getInfo']);

// 获取路由信息
Route::get('/getRouters', [App\Http\Controllers\System\SysLoginController::class, 'getRouters']);
